<?php
$cs = Yii::app()->getClientScript();
$cs->registerCSSFile(Yii::app()->request->baseUrl . '/css/mobile/booking_find_1.css');
$screen = Blyn::app()->getUIManager()->getCurrentScreen();
$wxControl = $screen->getChildControl('BUIWXControl_1');
$wxControl->renderView('booking_home', array());
$user = Blyn::app()->getCurrentUser(); //get user
$findTextArr = BWeSport::explodeFindtextToArray($findText); //拆分findText到findTextArr
$event = new BWEvent($findTextArr['eventId']); //根据$eventId获取当前的场馆
$eventName = $event->getName();
$vender = $event->getMessageManager()->getMessage('vender');
$vendeImage = $vender->getMediaManager()->getMedia('image')->getContent();
$venueAddress = $vender->getMediaManager()->getMedia('venueAddress')->content;//场馆地址
$venderPhone = $vender->getMediaManager()->getMedia('venderPhone')->content;
$bookableList = $vender->getMessageManager()->getMessageList(); //获取场馆下面的可预订项
$firstBookable = reset($bookableList);  //获取第一个预订项
$bookableId = $firstBookable->getId();  //获取第一个预订项id
/*获取第一个预订项的价格*/
$priceList = BAPriceAdjust::getUserPrice($bookableId);
if ($priceList == NULL || empty($priceList)) {
    $minPriceName = '基本会员价格';
    $bookable = new BWMessage($bookableId);
    $priceMedia = $bookable->getMediaManager()->getMedia('price');
    if ($priceMedia) {
        $minPrice = $priceMedia->content;
    }
} else {
    $minPriceName = $priceList['minPrice']['priceName'];
    $minPrice = $priceList['minPrice']['price'];
}
?>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="full-screen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<style>
.album {height: 3.9rem;position: relative;overflow: hidden;}
.album img {width: 100%;min-height: 100%;-webkit-transform: translateY(-50%);-ms-transform: translateY(-50%);-moz-transform: translateY(-50%);top: 50%;position: relative;}
.album .desc {position: absolute;bottom: 0;width: 100%;color: white;text-align: center;height: .56rem;line-height: .56rem;font-size: .24rem;background: rgba(0, 0, 0, .5);}
ul.ul {list-style-type: none;padding-left: 8px;}
ul.ul li {font-size: .3rem;margin: .1rem 0;line-height: 1.5;}
/*///*/
#deal-detail .buy-price {color: #999;position: relative;}
.buy-price .price {vertical-align: text-top;}
.buy-price strong {font-size: .66rem;}
.buy-price space {width: .16rem;}
.buy-price .buy-btn {position: absolute;right: .2rem;top: .21rem;//width: 2.6rem;}
.buy-desc h1 {font-size: .36rem;margin: 0;margin-bottom: .22rem;color: #000;}
.buy-desc p {margin: 0;color: #666;}
.court_targs {width: 100%;margin: 0;padding: 0;text-align: center;border-spacing: 10px 5px;border-collapse: separate;}
.court_targs table {width: 100%;height: 30px;border: 1px solid #F4A36B;min-width:160px;}
.court_targs table tr td:first-child {width: 70px;background: #F4A36B;}
</style>
</head>
<body>
    <header class="navbar">
        <div class="nav-wrap-left">
            <a class="react back" href="<?php echo $wxControl->getLinkUrl(array('name'=>'返回', 'id'=>'booking_list'), array('listPage'=>$backPage,'findText'=>$findText,'findContext'=>'','nowCity'=>$nowCity));?>"><i class="text-icon icon-back"></i></a>
        </div>
        <h1 class="nav-header"><?php echo $flagText;?></h1>
        <?php $wxControl->renderView('booking_navigation', array());?>
    </header>
    <script type="text/javascript">
    function loaderDiv() {
        document.getElementById("ajax-loaderdiv").style.display = "block";
    }
    </script>
    <div id="deal" class="deal">
        <div class="list">
            <div class="album">
                <input id="jing" type="hidden" value="<?php echo '$longitude'; ?>"/>
                <input id="wei" type="hidden" value="<?php echo '$latitude'; ?>"/>      
                <img src="<?php echo Yii::app()->request->baseUrl . $vendeImage ?>"/>
                <div class="desc"><?php echo $eventName; ?></div>
            </div>
            <dl class="list list-in">
                <dd class="dd-padding buy-price">
                    <div class="price">
                        <strong class="J_pricetag strong-color"><?php echo $minPrice; ?></strong><span class="strong-color">元/小时</span>(<?php echo $minPriceName;?>)
                    </div>
                    <span class="wrapper buy-wrapper" onclick="loaderDiv()">
                        <?php echo $wxControl->getLink(array('name' => '预订场地', 'id' => 'booking_choose_time'), array('bookableId'=>$bookableId,'findText'=>$findText,'flagText'=>$flagText, 'backPage'=>$backPage, 'nowCity'=>$nowCity, 'htmlOptions' => array('class' => 'btn btn-strong btn-tip  buy-btn btn-large'))); ?>
                    </span>
                </dd>
                <dd class="list list-in" style="padding: 10px 5px;color: #443233;">
                    <p>球场描述：<?php echo $event->description;?></p>
                </dd>
                <dd class="list list-in" style="padding: 10px 5px;color: #443233;">
                    <p><img src="<?php echo Yii::app()->request->baseUrl.'/images/BWeSport/position.png';?>" width="30" height="30"/><?php echo $venueAddress;?></p>
                </dd>
                <dd class="list list-in" style="padding: 10px 5px;color: #443233;">
                    <p><img src="<?php echo Yii::app()->request->baseUrl.'/images/BWeSport/phone.png';?>" width="30" height="30"/> <?php echo $venderPhone;?></p>
                </dd>
                <dd class="list list-in" style="padding: 10px 5px;color: #443233;">
                    <table class="court_targs">
                        <tr>
                            <td>
                                <table><tr><td>休息区域</td><td>休息区域宽厂</td></tr></table>
                            </td>
                            <td>
                                <table><tr><td>停车位</td><td>免费停车</td></tr></table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table><tr><td>场馆卖品</td><td>饮料有售</td></tr></table>
                            </td>
                            <td>
                                <table><tr><td>柜子租赁</td><td>有</td></tr></table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table><tr><td>洗浴设施</td><td>暂无</td></tr></table>
                            </td>
                            <td>
                                <table><tr><td>器材维护</td><td>有</td></tr></table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table><tr><td>器材租借</td><td>有</td></tr></table>
                            </td>
                            <td></td>
                        </tr>
                    </table>
                </dd>
            </dl>
        </div>
        <div class="wrapper buy-wrapper" onclick="loaderDiv()">
            <?php echo $wxControl->getLink(array('name' => '预订场地', 'id' => 'booking_choose_time'), array('bookableId'=>$bookableId,'findText'=>$findText,'flagText'=>$flagText, 'backPage'=>$backPage, 'nowCity'=>$nowCity, 'htmlOptions' => array('class' => 'btn btn-strong btn-tip  buy-btn btn-block btn-larger'))); ?>
        </div>

    </div>
    <div id="ajax-loaderdiv" style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 35000;background-color: rgba(0, 0, 0, 0.3);display: none;">
        <img src="/billyn-dev/images/ajax-loader.gif" class="ajax-loader"style="position: absolute;left: 50%;top: 50%;margin-left: -16px;margin-top: -16px;display: block;"/>
    </div>
    <footer>
        <div class="footer-copyright">
            <div class="hr"></div>
            <span class="footer-copyright-text">
                        Copyright © 2014 billyn.net </span>
        </div>
    </footer>